package homework10;

import java.util.Scanner;

class ArrayUtils{
	public static double findMax(double[] arr,int begin, int end) throws IllegalArgumentException{
		if(begin<0){
			throw new IllegalArgumentException("begin:"+begin+" < 0");
		}
		
		if(end>arr.length){
			throw new IllegalArgumentException("end:"+end+" > "+arr.length);
		}
		
		if(begin>=end){
			throw new IllegalArgumentException("begin:"+begin+" >= end:"+end);
		}
		double max=arr[begin];
		for(int i=begin;i<end;i++){
			if(max<arr[i]) max=arr[i];
		}
		return max;
	}
}

public class Seven03 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[]=new int[Integer.parseInt(sc.nextLine())];
		for(int i=0;i<a.length;i++)	a[i]=sc.nextInt();
		
		while(true){
			int begin=sc.nextInt();
			int end=sc.nextInt();
			if(begin
			
		}
		try {
			System.out.println(ArrayUtils.class.getDeclaredMethod("findMax", double[].class,int.class,int.class));
		} catch (Exception e1) {
		} 
		
		
		
		
		
		sc.close();
	}

}
